home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl150l.zip / IO / FGETPOS.C < prev    next >
C/C++ Source or Header  |  1996-07-26  |  414b  |  21 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <libp.h>
  4.  
  5. int fgetpos(FILE *stream, fpos_t *curpos)
  6. {
  7.     if (stream->token == FILTOK) {
  8.         *curpos = _ll_getpos(stream->fd);
  9.         if (*curpos < 0) {
  10.             stream->flags |= _F_ERR;
  11.             return EOF;
  12.         }
  13.         if (stream->flags & _F_IN)
  14.             *curpos -= stream->level;
  15.         else            
  16.             if (stream->flags & _F_OUT)
  17.                 *curpos += stream->level;
  18.         return 0;
  19.     }
  20.     return EOF;
  21. }